package at.fhv.androideightpuzzle.network.message;

import org.json.simple.JSONObject;

public class JoinGameMessage implements IMessage{
	
	public static final int TYPE=1;
	
	private String m_playerName;
	
	public JoinGameMessage(String playerName){
		m_playerName=playerName;
	}
	
	@SuppressWarnings("unchecked")
	public String getJson(){
		JSONObject jsonObj=new JSONObject();
		
		jsonObj.put("type",JoinGameMessage.TYPE);
		
		JSONObject payload=new JSONObject();
		
		payload.put("playername",m_playerName);
		
		jsonObj.put("payload",payload);
		
		return jsonObj.toJSONString();
	}
	
	public String getPlayerName(){
		return m_playerName;
	}
}
